package com.smile.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smile.model.dao.AirlineDAO;
import com.smile.model.domain.CountFlight;
import com.smile.model.domain.FeisuanAirline;
import com.smile.model.domain.FeisuanFlightStatistics;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Mapper
public interface FlightStatisticsMapper extends BaseMapper<FeisuanFlightStatistics> {

    @Select("select sum(total_task_time) as time,sum(total_task_distance) as distance,sum(task_count) as num from feisuan_flight_statistics where drone_id = #{droneId}")
    CountFlight countFlight(Long droneId);


    @Select("select sum(total_task_time) as time,sum(total_task_distance) as distance,sum(task_count) as num from feisuan_flight_statistics where airport_id = #{airportId} and statistics_date > #{startDate}  and statistics_date <= #{endDate}")
    CountFlight countFlightByAirport(Long airportId, LocalDate startDate, LocalDate endDate);
}
